export const state = () => ({
  err: 1,
  msg:'未登录',
  token:'',
  data: {},
  rank: 1
})

//同步
export const mutations = {
  M_UPDATE_USER(state, payload) {
    state.err = payload.err;
    state.msg = payload.msg;
    state.token = payload.token;
    state.data = payload.data;
    state.rank = payload.rank;
  },
   M_UPDATE_USER_TOKEN(state, payload) {
    state.token = payload;
  }

}

//异步
export const actions = {
  A_UPDATE_USER({commit,user},payload){
    //异步处理
    commit('M_UPDATE_USER',payload)
  }
}
